#ifndef MPICKER_H
#define MPICKER_H

#include <QGraphicsScene>

#include "mbox.h"
#include "mtextbox.h"
#include "mgame.h"
#include "mselector.h"

class MPicker : public QGraphicsScene
{
    Q_OBJECT
public:
    enum {
        OFFSET_X = 25,
        OFFSET_Y = 40,
        STEP_X = 44,
        STEP_Y = 44
    };
    explicit MPicker(QObject *parent = 0);

    void updateBoxes(MGame *game);

    std::multiset<MCard> getSelected();
    
    void setParentWidget(QWidget *w);
signals:
    void evilSelected(MGame::PlayerID);

public slots:
    // on mouse move
    void workSelection(int l, int u, int r, int d);
    // on mouse release
    void releaseSelection();
    // clear selection
    void resetSelection();
    // on mouse move
    void checkOver(int x, int y);

private:
    MBox *boxes[15][4];
    bool selected[15][4];

    MSelector *s;

    bool evilmode;
    MTextBox *prev, *you, *next, *clear;

    QWidget *parent_widget;
};

#endif // MPICKER_H
